<?php

namespace App\Admin\Actions\Post;


use Encore\Admin\Actions\RowAction;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;

class CheckOrder extends RowAction
{
    public $name = '核销订单';

    public function handle(Model $model,Request $request)
    {


        $model->check_status = 1;
        $model->order_status = 2;
        $model->check_time = date("Y-m-d H:i:s");

        $res = $model->save();

        if($res)
            return $this->response()->success('核销成功')->refresh();


        return $this->response()->error('核销失败')->refresh();


    }


    public function dialog()
    {
        $this->confirm('确定核销？');
    }



}
